package com.hee.erp.modules.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hee.erp.modules.entity.AuditResult;
import com.hee.erp.modules.mapper.AuditResultMapper;
import com.hee.erp.modules.service.IAuditResultService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author weizehong
 * @since 2022-05-27
 */
@Service
public class AuditResultServiceImpl extends ServiceImpl<AuditResultMapper, AuditResult> implements IAuditResultService {

    @Override
    public void updateByMainId(AuditResult auditResult, String auditMainId) {
        LambdaQueryWrapper<AuditResult> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AuditResult::getAuditMainId, auditMainId);

        this.update(auditResult,queryWrapper);
    }

    @Override
    public AuditResult getByMainId(String mainId) {
        LambdaQueryWrapper<AuditResult> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(AuditResult::getAuditMainId, mainId);

        return this.getOne(queryWrapper);
    }
}
